﻿<DemoPageSectionComponent Id="DialogsAndWindows-DropDown-Position" ShowSizeMode="true">
    <OptionsContent>
        <OptionComboBox Label="Position Mode:" CssClass="ow-100" Data="@PositionModeSource" @bind-Value="@PositionMode"/>
    </OptionsContent>
    <ChildContentWithParameters Context="Params">
        <div id="dropdown-position-target-container">
            <DxButton
                Click="() => IsOpen = !IsOpen"
                RenderStyle="@ButtonRenderStyle.Secondary">SHOW A DROPDOWN</DxButton>
        </div>

        <DxDropDown
            @bind-IsOpen="@IsOpen"
            HeaderVisible="true"
            HeaderText="Header"
            BodyText="@Constants.Content"
            Width="max(25vw, 250px)"
            PositionTarget="#dropdown-position-target-container"
            PositionMode="@PositionMode"
            CloseMode="DropDownCloseMode.Close"
            SizeMode="Params.SizeMode"
            PreventCloseOnPositionTargetClick="true">
        </DxDropDown>
    </ChildContentWithParameters>

    @code {
        DropDownPositionMode[] PositionModeSource { get; set; } = Enum.GetValues<DropDownPositionMode>().Except(new [] { DropDownPositionMode.Absolute, DropDownPositionMode.AbsolutePoint }).ToArray();
        DropDownPositionMode PositionMode { get; set; } = DropDownPositionMode.Bottom;
        bool IsOpen { get; set; } = false;
    }

</DemoPageSectionComponent>
